# controller

# build the page with the information text for raid-1

from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from Utilities import *

class BuildRaidInfoPage(webapp.RequestHandler):
    def get(self, pSelf, templateValues, raidLevel, infoUrl):
        utilities = Utilities()
        
        # menu-text
        credentialsText = utilities.getMenuTextCredentials()
        yourDataText = utilities.getMenuTextYourData()
        info = utilities.getMenuTextInfo()
        
        # get same basic place-holder
        title = utilities.getTitleText()
        userText = templateValues['userText']
        username = templateValues['user']
        url = templateValues['url']
        urlText = templateValues['urlText']
        hintText = templateValues['hintText']
        hintColor = templateValues['hintColor']
        
#        headline = self.getHeadline()
        headline = templateValues['headline']
        infoText = templateValues['infoText']
        buttons = self.buildButtons(infoUrl)
        
        finalTemplateValues = {
                               'title': title,
                               'userText': userText,
                               'user': username,
                               'url': url,
                               'urlText': urlText,
                               'hintText': hintText,
                               'hintColor': hintColor,
                               'credentials': credentialsText,
                               'yourData': yourDataText,
                               'info': info,
                               'headline': headline,
                               'infoText': infoText,
                               'buttons': buttons
                               }
            
        html = template.render('view/templates/' + raidLevel + '.html', finalTemplateValues)
                
        pSelf.response.out.write(html)
        
    # build the buttons to navigate...
    def buildButtons(self, infoUrl):
#        back = _('back')
#        more = _('more')
        back = 'back'
        more = 'more'
        
        buttons = ''
        buttons = buttons + '<table>'
        buttons = buttons + '<a href="/chooseraidlevel" title="' + back + '" >'
        buttons = buttons + '<input type="submit" value="' + back + '" >'
        buttons = buttons + '</a>'

        buttons = buttons + '<a href="' + infoUrl + '" title="' + more + '" >'
        buttons = buttons + '<input type="submit" value="' + more + '" >'
        buttons = buttons + '</a>'
        buttons = buttons + '</table>'
        
        return buttons
        
        